// import {io} from "socket.io-client";
//
// let syncUtil = {};
//
// syncUtil.sync = function () {
//
//     const ip = "255.255.255.255"
//     // const ip = "127.0.0.1"
//     const port = "7000"
//
//     const socket = io(`${ip}:${port}`);
//     return (async () => {
//         socket.on("connect", () => {
//             console.log("connect==>", socket.connected); // true
//             const engine = socket.io.engine;
//             console.log(engine.transport.name); // in most cases, prints "polling"
//
//             engine.once("upgrade", () => {
//                 // called when the transport is upgraded (i.e. from HTTP long-polling to WebSocket)
//                 console.log(engine.transport.name); // in most cases, prints "websocket"
//             });
//
//             engine.on("packet", ({type, data}) => {
//                 // called for each packet received
//             });
//
//             engine.on("packetCreate", ({type, data}) => {
//                 // called for each packet sent
//             });
//
//             engine.on("drain", () => {
//                 // called when the write buffer is drained
//             });
//
//             engine.on("close", (reason) => {
//                 // called when the underlying connection is closed
//             });
//         });
//
//         socket.on("data", () => {
//             console.log("data==>", socket.connected); // true
//             socket.emit("hello", "world");
//         });
//
//         socket.timeout(5000).emit("PC同步数据：", JSON.stringify(data), (err: any, responses: any) => {
//             if (err) {
//                 // some clients did not acknowledge the event in the given delay
//             } else {
//                 console.log(responses); // one response per client
//             }
//         });
//
//         socket.on("disconnect", () => {
//             console.log(socket.connected); // false
//         });
//
//     }
//     export default syncUtil;
